import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
const { UNI_PLATFORM } = process.env;

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni()],
  resolve: {
    alias: {
      flyio: UNI_PLATFORM !== "h5" ? "flyio/dist/npm/wx" : "flyio/dist/npm/fly",
    },
  },
  server: {
    proxy: {
      "/api": {
        target: "https://api.ithome.com",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
});
